/*!
 * \file Hooker.h
 * \date 2015/11/09 21:13
 *
 * \author HappyXiaox
 * Contact: 475647575@qq.com
 *
 * \brief base class for all hooker
 *
 * \note
*/


#ifndef AbstractHooker_h__
#define AbstractHooker_h__


class AbstractHooker
{
protected:
    virtual bool initHook() = 0;
    virtual void hookAll() = 0;
    virtual void unhookAll() = 0;
public:
    void hook()
    {
        if (!initialized)
        {
            if (initHook())
                initialized = true;
        }
        return hookAll();
    }
    void unhook()
    {
        if (!initialized)
            return;
        return unhookAll();
    }
private:
    bool initialized = false;
};

#endif // AbstractHooker_h__